package com.tiandao.mofang.core.role;

import com.tiandao.mofang.core.RobotSingleton;

import java.awt.*;
import java.awt.event.KeyEvent;

public class BaseRole extends Thread {

    public static Robot robot = RobotSingleton.getInstance();
    /**
     * 左翻滚
     */
    public static void rollLeft(){
        try {
            Thread.sleep(300);
            robot.keyPress(KeyEvent.VK_A);
            robot.keyPress(KeyEvent.VK_SHIFT);
            robot.keyRelease(KeyEvent.VK_SHIFT);
            robot.keyRelease(KeyEvent.VK_A);
            Thread.sleep(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    /**
     * 右翻滚
     */
    public static void rollRight(){
        try {
            Thread.sleep(300);
            robot.keyPress(KeyEvent.VK_D);
            robot.keyPress(KeyEvent.VK_SHIFT);
            robot.keyRelease(KeyEvent.VK_SHIFT);
            robot.keyRelease(KeyEvent.VK_D);
            Thread.sleep(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    /**
     * 前翻滚
     */
    public static void rollFront(){
        try {
            Thread.sleep(300);
            robot.keyPress(KeyEvent.VK_W);
            robot.keyPress(KeyEvent.VK_SHIFT);
            robot.keyRelease(KeyEvent.VK_SHIFT);
            robot.keyRelease(KeyEvent.VK_W);
            Thread.sleep(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    /**
     * 后翻滚
     */
    public static void rollAfter(){
        try {
            Thread.sleep(300);
            robot.keyPress(KeyEvent.VK_S);
            robot.keyPress(KeyEvent.VK_SHIFT);
            robot.keyRelease(KeyEvent.VK_SHIFT);
            robot.keyRelease(KeyEvent.VK_S);
            Thread.sleep(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
